﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Motoball.screenmanager;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace Motoball.screens
{
    public class SingleMultiScreen:OptionsSelectScreen
    {
        bool exitToMenu = true;

        public SingleMultiScreen(ScreenManager screenManager, float finalDrawRadius, string screenName, MenuScreen parentScreen)
            : base(screenManager, finalDrawRadius, screenName, parentScreen)
        {
            TopItem = 0;
        }

        public override void LoadContent()
        {
            AddItem(new MenuItem(screenManager.Content.Load<Texture2D>("Images\\menupaddle2_singleplayer")));
            AddItem(new MenuItem(screenManager.Content.Load<Texture2D>("Images\\menupaddle2_multiplayer")));
        }

        public override void Reset()
        {
            exitToMenu = true;
            base.Reset();
        }

        protected override void Exit()
        {
            if (exitToMenu)
            {
                MainMenuScreen menu = (MainMenuScreen)parentScreen;
                menu.Reset();
                screenManager.AddScreen(menu);
            }
            else
            {
                GameplayScreen gameplay = (GameplayScreen)screenManager.GetScreen("game");
                //if singlePlayer selected disable AI otherwise enable
                gameplay.AIEnabled = TopItem == 0;
                gameplay.StartGame(true);
            }
            base.Exit();
        }

        protected override bool DoSomething()
        {
            exitToMenu = false;
            return true;
        }        
    }
}
